package WTE;

import java.util.Scanner;

public class Demo_08 {
    /**
     * 两种排序方法(垃圾)
     */
    public void method01() {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        boolean flag1 = true; // 字典
        boolean flag2 = true; // 长度

        String str1 = in.nextLine();
        String str2;

        for (int i = 0; i < n; i++) {
            str2 = in.nextLine();

            int len1 = str1.length();
            int len2 = str2.length();

            if (len1 > len2) {
                flag2 = false;
            }

            // 判断字典顺序
            int index = 0;
            while (index < len1 && index < len2) {
                if (str1.charAt(index) > str2.charAt(index)) {
                    flag1 = false;
                    break;
                }
                index++;
            }

            if (!flag1 && !flag2) {
                System.out.println("none");
                return;
            }
            str1 = str2;
        }

        if (flag1 && flag2) {
            System.out.println("both");
        }
        if (!flag1) {
            System.out.println("lengths");
        }
        if (!flag2) {
            System.out.println("lexicographically");
        }
    }

    /**
     * 求最小公倍数
     */
    public void method02() {
        Scanner in = new Scanner(System.in);
        int num1 = in.nextInt();
        int num2 = in.nextInt();

        int max = Math.max(num1, num2);
        for (int i = max; i <= num1*num2; i += max){
            if(i % num1 == 0 && i % num2 == 0){
                System.out.println(i);
            }
        }
    }

}
